home *** CD-ROM | disk | FTP | other *** search
/ Mac Easy 2010 May / Mac Life Ubuntu.iso / casper / filesystem.squashfs / var / lib / python-support / python2.6 / gnome_sudoku / simple_debug.pyc (.txt) < prev    next >
Encoding:
Python Compiled Bytecode  |  2009-04-20  |  1.9 KB  |  42 lines

  1. # Source Generated with Decompyle++
  2. # File: in.pyc (Python 2.6)
  3.  
  4. import optparse
  5. import defaults
  6. parser = optparse.OptionParser(version = defaults.VERSION, option_list = [
  7.     optparse.make_option('-v', const = True, action = 'store_const', dest = 'debug', help = 'Print debug information', default = False),
  8.     optparse.make_option('-p', const = True, action = 'store_const', dest = 'profile', help = 'Profile gnome-sudoku', default = False),
  9.     optparse.make_option('-w', const = True, action = 'store_const', dest = 'walk', help = 'Step through program', default = False)])
  10. (options, args) = parser.parse_args()
  11. if options.debug:
  12.     
  13.     def simple_debug(f):
  14.         
  15.         def _(self, *args, **kwargs):
  16.             print self.__class__, f.__name__, args, kwargs
  17.             return f(self, *args, **kwargs)
  18.  
  19.         return _
  20.  
  21. elif options.walk:
  22.     ff = []
  23.     
  24.     def simple_debug(f):
  25.         
  26.         def _(self, *args, **kwargs):
  27.             if (self.__class__, f.__name__) not in ff:
  28.                 print self.__class__, f.__name__, args, kwargs
  29.                 if raw_input('Hit return to step forward (hit i to ignore this function): ') == 'i':
  30.                     ff.append((self.__class__, f.__name__))
  31.                 
  32.             
  33.             return f(self, *args, **kwargs)
  34.  
  35.         return _
  36.  
  37. else:
  38.     
  39.     def simple_debug(f):
  40.         return f
  41.  
  42.